# pip3 install langchain_openai
# python3 langchain_deepseek_hello1.py
from langchain_openai.chat_models.base import BaseChatOpenAI
import sys
import os

# 添加项目根目录到Python路径
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', '..'))

from config_reader import get_deepseek_api_key

# 从配置文件中获取API密钥
api_key = get_deepseek_api_key()

llm = BaseChatOpenAI(
    model='deepseek-chat', 
    openai_api_key=api_key, 
    openai_api_base='https://api.deepseek.com',
    max_tokens=1024
)

response = llm.invoke("Hi!")
print(response.content)